﻿<style>
</style>
<div class="layui-row">
    <div class="layui-col-md12">
        <table style="width: 100%;">
            <tr>
                <td style="width: 100%;">
                    <div class="layui-progress layui-progress-big" lay-showPercent="yes">
                        <div class="layui-progress-bar layui-bg-green progress-rate" style="width: 0%;">
                <span class="layui-progress-text"><span style="margin-left: 5px;"
                                                            class="progress-rate-value">0%</span></span>
                        </div>
                    </div>
                </td>
                <td style="width: 100px;"><a class="layui-btn layui-btn-xs" id="quitproject">退出项目</a></td>
            </tr>
        </table>
        <table lay-filter="userlist1">
            <thead>
            <tr>
                <th lay-data="{field:'username', width:64}"></th>
                <th lay-data="{field:'experience', width:100, sort:true}">姓名</th>
                <th lay-data="{field:'sign'}">邮箱</th>
            </tr>
            </thead>
            <tbody id="userlist1">
            </tbody>
        </table>
    </div>
</div>
<!-- layui规范化用法 -->
<script type="text/javascript">

    workUtils.onclick("#quitproject", function () {
        workUtils.ajaxPost('../project/quit', {
            projectId: workUtils.get("projectId")
        }, function (result) {
            layer.msg(result.msg, {time: 1000},function () {
                $("#cloudwork").click();
            });
        }, "确定退出该项目吗?");
    });

    /*刷新任务*/
    function loadDefaultData() {
        var id = workUtils.get("projectId");
        workUtils.ajaxGet("../project/projectuser/", {projectId: id}, function (data) {
            var html = '';
            for (var i = 0; i < data.length; i++) {
                var item = data[i];
                html += "<tr>";
                html += '<td class="userphoto" ><img src="../photo/get/' + item.user.id + '"  class="layui-nav-img user-photo" style="width: 32px;height: 32px;"></td>';
                html += '<td class="userinfo" >' + item.user.name + '</td>';
                html += '<td class="userinfo" >' + item.user.email + '</td>';
                html += "</tr>";
            }
            $("#userlist1").html(html);
            //转换静态表格
            table.init('userlist1', {
                height: 'full-135'
                , limit: 1000
            });
        });

        $.getJSON("../project/getstat/" + workUtils.get("projectId"), function (data) {
            $(".progress-rate").css("width", data.l3 + "%");
            $(".progress-rate-value").text(data.l3 + "%");
        });
    }
    var table = null;
    layui.use(['layer', 'table', 'element'], function () {
        var element = layer.element;
        table = layui.table;
        loadDefaultData();

    });

</script>